﻿using System;

using Game.Common;
using Game.Common.Resources;
using Game.Objects;

namespace Game.Actions
{
    public class ConsumeResource : ContainerAction
    {
        readonly GameResource _ToGet;
        
        public ConsumeResource(ContainerBase container, GameResource toGet)
            : base(container)
        {
            _ToGet = toGet;
        }
        
        protected override ActionResult Execute(GameTurn turn,
                                                Context context)
        {
            ContainerBase con = base.ContainerBase;
            
            GameResource resource = con.GameResources[_ToGet.Type];
            resource.Decrease(_ToGet.Value);
            
            return base.Execute(turn, context);
        }
    }
}
